﻿using System;
using System.ComponentModel.DataAnnotations.Schema;
using Learun.Util;
using SqlSugar;

namespace Learun.Application.WorkFlow
{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创建人：研发部
    /// 日 期：2018.12.06
    /// 描 述：工作流任务执行人对应关系表(新)
    /// </summary>
    [SugarTable(TableName = "LR_NWF_TASKRELATION")]
    public class NWFTaskRelationEntity
    {
        #region 实体成员 
        /// <summary> 
        /// 主键 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(ColumnName = "F_ID", IsPrimaryKey = true)]
        public string F_Id { get; set; }
        /// <summary> 
        /// 任务主键 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(ColumnName = "F_TASKID")]
        public string F_TaskId { get; set; }
        /// <summary> 
        /// 任务执行人员主键 
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(ColumnName = "F_USERID")]
        public string F_UserId { get; set; }
        /// <summary>
        /// 标记0需要处理1暂时不需要处理
        /// </summary>
        [SugarColumn(ColumnName = "F_MARK")]
        public int? F_Mark { get; set; }
        /// <summary>
        /// 处理结果0.未处理1.同意2.不同意3.超时4.其他
        /// </summary>
        [SugarColumn(ColumnName = "F_RESULT")]
        public int? F_Result { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        [SugarColumn(ColumnName = "F_SORT")]
        public int? F_Sort { get; set; }
        /// <summary>
        /// 任务执行时间
        /// </summary>
        [SugarColumn(ColumnName = "F_TIME")]
        public DateTime? F_Time { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CREATETIME")]
        public DateTime? CreateTime { get; set; }
        /// <summary> 
        /// 创建人
        /// </summary> 
        /// <returns></returns> 
        [SugarColumn(ColumnName = "CREATEUSERID")]
        public string CreateUserId { get; set; }
       
        /// <summary>
        /// 是否查看 1：查看 0：未查看
        /// </summary>
        [SugarColumn(ColumnName = "ISLOOK")]
        public int? IsLook { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        [SugarColumn(ColumnName = "UPDATETIME")]
        public DateTime? UpdateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        [SugarColumn(ColumnName = "UPDATEUSERID")]
        public string UpdateUserId { get; set; }
        #endregion

        #region 扩展操作 
        /// <summary> 
        /// 新增调用 
        /// </summary> 
        public void Create()
        {
            UserInfo userInfo = LoginUserInfo.Get();
            this.F_Id = Guid.NewGuid().ToString();
            this.CreateTime = DateTime.Now;
            this.CreateUserId = userInfo.userId;
        }
        /// <summary> 
        /// 编辑调用 
        /// </summary> 
        /// <param name="keyValue"></param> 
        public void Modify(string keyValue)
        {
            UserInfo userInfo = LoginUserInfo.Get();
            this.F_Id = keyValue;
            this.UpdateTime = DateTime.Now;
            this.UpdateUserId = userInfo.userId;
        }
        #endregion

        #region 扩展字段
        /// <summary>
        /// 任务执行人员姓名
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsIgnore = true)]
        public string F_RealName { get; set; }
        #endregion
    }
}
